//
// Created by hsj on 2022/1/5.
//
#include <iostream>
#include <cctype>
#include "t_cctype.h"


//测试cctype
void test_cctype(){
    using namespace std;

    cout<<"input text for analysis ,and chart @ to terminate input."<<endl;

    char ch;
    int whitspace = 0;
    int digits = 0;
    int chars = 0;
    int puncts = 0;
    int others = 0;

    while ((ch = cin.get()) && ch != '@'){
        if (isalpha(ch)){
            ++chars;
        }
        else if(isdigit(ch)){
            ++digits;
        }
        else if(isspace(ch)){
            ++whitspace;
        }
        else if(ispunct(ch)){
            ++puncts;
        }
        else{
            ++others;
        }
    }

    cout<<"whitspace:"<<whitspace<<endl;
    cout<<"digits:"<<digits<<endl;
    cout<<"chars:"<<chars<<endl;
    cout<<"puncts:"<<puncts<<endl;
    cout<<"others:"<<others<<endl;

    /**
     * 某次测试：
     * hsj is smart! .. 123456 haha & @
     *
        whitspace:7
        digits:6
        chars:14
        puncts:4
        others:0
     */
}